import React from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import AuthRoute from './components/AuthRoute';
import Login from './pages/Login/Login';
import MainLayout from './components/MainLayout';
import ArticleView from './pages/ArticleView/ArticleView';
import ArticleDetail from './pages/ArticleDetail/ArticleDetail';
import WorkView from './pages/WorkView/WorkView';
import './App.css';

function App() {
  return (
    <ConfigProvider locale={zhCN}>
      <Router>
        <div className="App">
          <Routes>
            <Route path="/login" element={<Login />} />
            <Route path="/article/:id" element={<ArticleView />} />
            <Route path="/article-detail/:id" element={<ArticleDetail />} />
            <Route path="/work/:id" element={<WorkView />} />
            <Route 
              path="/*" 
              element={
                <AuthRoute>
                  <MainLayout />
                </AuthRoute>
              } 
            />
          </Routes>
        </div>
      </Router>
    </ConfigProvider>
  );
}

export default App;
